/********************************************************
	Code for Figure 2
	including lincom results
	Need to run this before the R code so that the R
	code can load/clean the lincom results
*********************************************************/

/******************************
Experiment 1
******************************/

clear
cd "C:\Users\Joshua\OneDrive\Documents\Work - Finished\BJPS - Comp Explanations\Dataverse"
use exp1_cleaned.dta

****Model
regress therm01 ib3.cond_info i.cond_party

		margins, dydx(4.cond_info 5.cond_info 6.cond_info) post coeflegend
		
		*Teachers vs. Partisan
		test _b[4.cond_info] =  _b[6.cond_info]

		lincomest _b[4.cond_info] -  _b[6.cond_info]
		parmest, label saving(exp1_teachers, replace)
		
		*Non-Partisan vs. Partisan
		regress therm01 ib3.cond_info i.cond_party
		margins, dydx(4.cond_info 5.cond_info 6.cond_info) post coeflegend
		
		test _b[5.cond_info] =  _b[6.cond_info]
		
		lincomest _b[5.cond_info] -  _b[6.cond_info]
		parmest, label saving(exp1_nonpartisan, replace)

/******************************
Experiment 2
******************************/

clear
use exp2_cleaned.dta

***Model
regress therm_post01 ib2.treat_expl i.treat_party therm_pre01

		*Tests
		margins, dydx(3.treat_expl 4.treat_expl) post coeflegend
		
		test _b[3.treat_expl] = _b[4.treat_expl]
		
		lincomest _b[3.treat_expl] - _b[4.treat_expl]
		parmest, label saving(exp2_high, replace)
		
		
/******************************
Experiment 3a
******************************/
clear
use exp3_cleaned.dta

****Gillibrand
regress gil_post01 ib2.gil_exp i.gil_pre i.gil_partisan i.gil_prox i.treat_order

		*LW - RW
		margins, dydx(3.gil_exp 4.gil_exp) post coeflegend
		
		test _b[3.gil_exp] = _b[4.gil_exp]
		
		lincomest _b[3.gil_exp] - _b[4.gil_exp]
		parmest, label saving(exp3_gil, replace)
		

****Corker
regress corker_post01 ib2.corker_exp i.corker_pre i.corker_partisan i.corker_prox i.treat_order

		
		*LW - RW
		margins, dydx(3.corker_exp 4.corker_exp) post coeflegend
		
		test _b[3.corker_exp] = _b[4.corker_exp]
		
		lincomest _b[3.corker_exp] - _b[4.corker_exp]
		parmest, label saving(exp3_corker, replace)
		
		
		